
<%--
Draws the top navigation

--%>
<%@include file="/apps/avventa/global.jsp"%><%
%><%@ page import="java.util.Iterator,
        com.day.text.Text,
        com.day.cq.wcm.api.PageFilter,
        com.day.cq.wcm.api.Page,
        com.day.cq.commons.Doctype,
        org.apache.commons.lang.StringEscapeUtils" %>
        
<ul id="navigation-1">
<%
// get pages from the dialog.

String[] pages = currentStyle.get("pages",String[].class);

// Check if the pages array is not null
if(pages != null) {
    
    // For each page in the array, display the Title.
    for(int i=0; i<pages.length; i++) {
    
        // Use the page manager to get the page node.
        Page p = pageManager.getPage(pages[i]);
        
        //Output the title!
        %><li><a href="<%=p.getPath()%>.html" target="_self"><span>></span><%=p.getTitle().toUpperCase() %></a>
        
        <%
        // Check if the page has children.
        Iterator<Page> children = p.listChildren(new PageFilter(request));
        // If children exist then create sub menu
        if(children.hasNext()) {
        	if(p.getTitle().toUpperCase().equals("OVERVIEW")){
            %><ul class="navigation-2"> <%
            while (children.hasNext()) {
                
                // While children exist, get the path and the title. 
                Page child = children.next(); %>
                <li>
                    <a href="<%=child.getPath()%>.html">
                    <%=child.getTitle() %></a>
                </li>
                <%
            } %>
            </ul> <%
        }}%>
        </li>
   <% } 
}
else {
    %> Configure the top nav <%
}
%>
</ul>